package com.yds.dubbo.hystrix.provider.impl;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yds.dubbo.hystrix.api.HelloService;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * @author liuhongzhen
 * @date 2023/3/24 15:15
 */
@DubboService(version = "1.0.0",timeout= 10000)
public class HelloServiceImpl implements HelloService {

    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000")})
    @Override
    public String sayHello(String name) {
        throw new RuntimeException("Exception to show hystrix enabled.");
    }

}
